package tcm.com.gistone.database.mapper;

import java.util.List;

import org.apache.ibatis.annotations.*;

import tcm.com.gistone.database.entity.Section;

@Mapper
public interface SectionMapper {
    int deleteByPrimaryKey(Long sectionId);

    int insert(Section record);

    int insertSelective(Section record);

    Section selectByPrimaryKey(Long sectionId);

    int updateByPrimaryKeySelective(Section record);

    int updateByPrimaryKey(Section record);

    int insertBatch(List<Section> list);

    @Select("select * from tb_section where book_id = #{bookId}")
    @ResultMap("tcm.com.gistone.database.mapper.SectionMapper.BaseResultMap")
    List<Section> selectByBookId(long bookId);

    @Select("select T1.* from (select * from tb_section )T1 join (select book_id from tb_special_book where special_id = #{specialId})T2 on T1.book_id = T2.book_id")
    @ResultMap("tcm.com.gistone.database.mapper.SectionMapper.BaseResultMap")
    List<Section> selectBySpecial(long specialId);

    @Select("select * from tb_section")
    @ResultMap("tcm.com.gistone.database.mapper.SectionMapper.BaseResultMap")
    List<Section> selectAll();
}